<%@ page import="java.util.Date" %>
<%@ page import="java.text.SimpleDateFormat" %><%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2020/5/28
  Time: 15:16
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>

<%

    request.setCharacterEncoding("UTF-8");

    String username = request.getParameter("username");
    String password = request.getParameter("password");

    if ( !("admin".equals(username) && "123456".equals(password))){

        response.sendRedirect(request.getContextPath()+"/session/login.jsp");
        return;
    }

    Date date = new Date();
    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy年 MM月 dd日 - HH时 mm分 ss秒");

    session.setAttribute("username",username);
    session.setAttribute("password",password);
%>

<h1>登陆成功！现在时间：<%= simpleDateFormat.format(date)%></h1>

<p>用户：<%= username %></p>
<p>密码：<%= password %></p>
<p>退出登陆：<a href="/JavaWeb/session/logout.jsp" style="text-decoration: none">点我退出</a></p>

</body>
</html>
